/*!
 * \file test_strategy_management_comprehensive.cpp
 * \project WonderTrader
 * 
 * \brief WonderTrader策略管理组件综合测试
 * 
 * \details 本文件包含对WonderTrader策略管理组件的全面测试，包括：
 *          - CtaStrategyMgr CTA策略管理器测试
 *          - HftStrategyMgr HFT策略管理器测试
 *          - SelStrategyMgr SEL策略管理器测试
 *          - 策略上下文管理测试
 *          - 策略工厂管理测试
 *          - 策略生命周期测试
 *          - 策略参数配置测试
 *          - 策略性能监控测试
 */

#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <memory>
#include <thread>
#include <chrono>

// WonderTrader策略管理头文件
#include "../../src/WtCore/CtaStrategyMgr.h"
#include "../../src/WtCore/HftStrategyMgr.h"
#include "../../src/WtCore/SelStrategyMgr.h"

// 策略上下文头文件
#include "../../src/Includes/ICtaStraCtx.h"
#include "../../src/Includes/IHftStraCtx.h"
#include "../../src/Includes/ISelStraCtx.h"

// 依赖组件头文件
#include "../../src/Includes/WTSVariant.hpp"
#include "../../src/Includes/WTSDataDef.hpp"
#include "../../src/WTSTools/WTSLogger.h"
#include "../../src/Share/StrUtil.hpp"

using namespace WTSTP;
using ::testing::_;
using ::testing::Return;
using ::testing::StrictMock;
using ::testing::NiceMock;

// ============================================================================
// Mock策略类定义
// ============================================================================

/*!
 * \class MockCtaStrategy
 * \brief CTA策略Mock类
 */
class MockCtaStrategy : public ICtaStrategy
{
public:
    MOCK_METHOD0(getName, const char*());
    MOCK_METHOD0(getFactName, const char*());
    MOCK_METHOD1(init, bool(WTSVariant* cfg));
    MOCK_METHOD1(on_init, void(ICtaStraCtx* ctx));
    MOCK_METHOD2(on_tick, void(ICtaStraCtx* ctx, const char* stdCode));
    MOCK_METHOD4(on_bar, void(ICtaStraCtx* ctx, const char* stdCode, const char* period, WTSBarStruct* newBar));
    MOCK_METHOD1(on_calculate, void(ICtaStraCtx* ctx));
    MOCK_METHOD1(on_calculate_done, void(ICtaStraCtx* ctx));
    MOCK_METHOD2(on_session_begin, void(ICtaStraCtx* ctx, uint32_t uTDate));
    MOCK_METHOD2(on_session_end, void(ICtaStraCtx* ctx, uint32_t uTDate));
    MOCK_METHOD0(release, void());
};

/*!
 * \class MockHftStrategy
 * \brief HFT策略Mock类
 */
class MockHftStrategy : public IHftStrategy
{
public:
    MOCK_METHOD0(getName, const char*());
    MOCK_METHOD0(getFactName, const char*());
    MOCK_METHOD1(init, bool(WTSVariant* cfg));
    MOCK_METHOD1(on_init, void(IHftStraCtx* ctx));
    MOCK_METHOD2(on_tick, void(IHftStraCtx* ctx, const char* stdCode));
    MOCK_METHOD3(on_order_queue, void(IHftStraCtx* ctx, const char* stdCode, WTSOrdQueData* newOrdQue));
    MOCK_METHOD3(on_order_detail, void(IHftStraCtx* ctx, const char* stdCode, WTSOrdDtlData* newOrdDtl));
    MOCK_METHOD3(on_transaction, void(IHftStraCtx* ctx, const char* stdCode, WTSTransData* newTrans));
    MOCK_METHOD4(on_bar, void(IHftStraCtx* ctx, const char* stdCode, const char* period, WTSBarStruct* newBar));
    MOCK_METHOD2(on_session_begin, void(IHftStraCtx* ctx, uint32_t uTDate));
    MOCK_METHOD2(on_session_end, void(IHftStraCtx* ctx, uint32_t uTDate));
    MOCK_METHOD0(release, void());
};

/*!
 * \class MockSelStrategy
 * \brief SEL策略Mock类
 */
class MockSelStrategy : public ISelStrategy
{
public:
    MOCK_METHOD0(getName, const char*());
    MOCK_METHOD0(getFactName, const char*());
    MOCK_METHOD1(init, bool(WTSVariant* cfg));
    MOCK_METHOD1(on_init, void(ISelStraCtx* ctx));
    MOCK_METHOD2(on_tick, void(ISelStraCtx* ctx, const char* stdCode));
    MOCK_METHOD4(on_bar, void(ISelStraCtx* ctx, const char* stdCode, const char* period, WTSBarStruct* newBar));
    MOCK_METHOD1(on_calculate, void(ISelStraCtx* ctx));
    MOCK_METHOD1(on_calculate_done, void(ISelStraCtx* ctx));
    MOCK_METHOD2(on_session_begin, void(ISelStraCtx* ctx, uint32_t uTDate));
    MOCK_METHOD2(on_session_end, void(ISelStraCtx* ctx, uint32_t uTDate));
    MOCK_METHOD0(release, void());
};

/*!
 * \class MockCtaStrategyFactory
 * \brief CTA策略工厂Mock类
 */
class MockCtaStrategyFactory : public ICtaStrategyFact
{
public:
    MOCK_METHOD0(getName, const char*());
    MOCK_METHOD1(createStrategy, ICtaStrategy*(const char* name, const char* id));
    MOCK_METHOD1(deleteStrategy, bool(ICtaStrategy* stra));
    MOCK_METHOD0(release, void());
};

// ============================================================================
// CtaStrategyMgr测试套件
// ============================================================================

class CtaStrategyMgrTest : public ::testing::Test
{
protected:
    void SetUp() override {
        WTSLogger::init("test_logs/", true);
        
        ctaMgr = std::make_unique<CtaStrategyMgr>();
        mockStrategy = std::make_unique<NiceMock<MockCtaStrategy>>();
        mockFactory = std::make_unique<NiceMock<MockCtaStrategyFactory>>();
        
        // 设置Mock默认行为
        ON_CALL(*mockStrategy, getName())
            .WillByDefault(Return("TestCtaStrategy"));
        ON_CALL(*mockStrategy, getFactName())
            .WillByDefault(Return("TestCtaFactory"));
        ON_CALL(*mockStrategy, init(_))
            .WillByDefault(Return(true));
            
        ON_CALL(*mockFactory, getName())
            .WillByDefault(Return("TestCtaFactory"));
        ON_CALL(*mockFactory, createStrategy(_, _))
            .WillByDefault(Return(mockStrategy.get()));
        ON_CALL(*mockFactory, deleteStrategy(_))
            .WillByDefault(Return(true));
    }
    
    void TearDown() override {
        WTSLogger::stop();
    }

protected:
    std::unique_ptr<CtaStrategyMgr> ctaMgr;
    std::unique_ptr<MockCtaStrategy> mockStrategy;
    std::unique_ptr<MockCtaStrategyFactory> mockFactory;
};

/*!
 * \brief 测试CTA策略管理器基本功能
 */
TEST_F(CtaStrategyMgrTest, TestBasicFunctionality)
{
    EXPECT_NE(ctaMgr.get(), nullptr);
    
    // 测试策略数量
    EXPECT_EQ(ctaMgr->count(), 0);
    
    // 测试获取不存在的策略
    EXPECT_EQ(ctaMgr->getStrategy("non_existent"), nullptr);
}

/*!
 * \brief 测试CTA策略工厂管理
 */
TEST_F(CtaStrategyMgrTest, TestFactoryManagement)
{
    // 测试添加工厂
    ctaMgr->regStrategy("TestCtaFactory", mockFactory.get());
    
    // 测试工厂是否正确注册
    // 注意：CtaStrategyMgr可能没有直接的工厂查询接口，这里测试策略创建
}

/*!
 * \brief 测试CTA策略创建和管理
 */
TEST_F(CtaStrategyMgrTest, TestStrategyCreation)
{
    // 注册工厂
    ctaMgr->regStrategy("TestCtaFactory", mockFactory.get());
    
    // 创建策略配置
    WTSVariant* cfg = WTSVariant::createObject();
    cfg->append("name", "TestStrategy", false);
    cfg->append("id", "test_001", false);
    cfg->append("factory", "TestCtaFactory", false);
    
    // 测试策略创建
    EXPECT_CALL(*mockFactory, createStrategy(_, _))
        .Times(1)
        .WillOnce(Return(mockStrategy.get()));
    
    // 这里需要根据实际的CtaStrategyMgr接口调整
    // 假设有createStrategy方法
    
    cfg->release();
}

/*!
 * \brief 测试CTA策略生命周期管理
 */
TEST_F(CtaStrategyMgrTest, TestStrategyLifecycle)
{
    // 测试策略初始化
    EXPECT_CALL(*mockStrategy, init(_))
        .Times(1)
        .WillOnce(Return(true));
    
    WTSVariant* cfg = WTSVariant::createObject();
    cfg->append("param1", "value1", false);
    
    bool result = mockStrategy->init(cfg);
    EXPECT_TRUE(result);
    
    cfg->release();
}

/*!
 * \brief 测试CTA策略事件处理
 */
TEST_F(CtaStrategyMgrTest, TestStrategyEvents)
{
    // 测试策略事件回调
    EXPECT_CALL(*mockStrategy, on_init(_))
        .Times(1);
    EXPECT_CALL(*mockStrategy, on_session_begin(_, _))
        .Times(1);
    EXPECT_CALL(*mockStrategy, on_session_end(_, _))
        .Times(1);
    
    // 模拟事件调用
    mockStrategy->on_init(nullptr);
    mockStrategy->on_session_begin(nullptr, 20241201);
    mockStrategy->on_session_end(nullptr, 20241201);
}

// ============================================================================
// HftStrategyMgr测试套件
// ============================================================================

class HftStrategyMgrTest : public ::testing::Test
{
protected:
    void SetUp() override {
        WTSLogger::init("test_logs/", true);
        
        hftMgr = std::make_unique<HftStrategyMgr>();
        mockStrategy = std::make_unique<NiceMock<MockHftStrategy>>();
        
        ON_CALL(*mockStrategy, getName())
            .WillByDefault(Return("TestHftStrategy"));
        ON_CALL(*mockStrategy, getFactName())
            .WillByDefault(Return("TestHftFactory"));
        ON_CALL(*mockStrategy, init(_))
            .WillByDefault(Return(true));
    }
    
    void TearDown() override {
        WTSLogger::stop();
    }

protected:
    std::unique_ptr<HftStrategyMgr> hftMgr;
    std::unique_ptr<MockHftStrategy> mockStrategy;
};

/*!
 * \brief 测试HFT策略管理器基本功能
 */
TEST_F(HftStrategyMgrTest, TestBasicFunctionality)
{
    EXPECT_NE(hftMgr.get(), nullptr);
    
    // 测试策略数量
    EXPECT_EQ(hftMgr->count(), 0);
}

/*!
 * \brief 测试HFT策略高频事件处理
 */
TEST_F(HftStrategyMgrTest, TestHighFrequencyEvents)
{
    // 测试高频数据处理
    EXPECT_CALL(*mockStrategy, on_tick(_, _))
        .Times(1);
    EXPECT_CALL(*mockStrategy, on_order_queue(_, _, _))
        .Times(1);
    EXPECT_CALL(*mockStrategy, on_order_detail(_, _, _))
        .Times(1);
    EXPECT_CALL(*mockStrategy, on_transaction(_, _, _))
        .Times(1);
    
    // 模拟高频事件
    mockStrategy->on_tick(nullptr, "SHFE.rb2401");
    mockStrategy->on_order_queue(nullptr, "SHFE.rb2401", nullptr);
    mockStrategy->on_order_detail(nullptr, "SHFE.rb2401", nullptr);
    mockStrategy->on_transaction(nullptr, "SHFE.rb2401", nullptr);
}

/*!
 * \brief 测试HFT策略性能要求
 */
TEST_F(HftStrategyMgrTest, TestPerformanceRequirements)
{
    const int EVENT_COUNT = 10000;
    
    auto start = std::chrono::high_resolution_clock::now();
    
    // 模拟高频事件处理
    for (int i = 0; i < EVENT_COUNT; ++i) {
        mockStrategy->on_tick(nullptr, "SHFE.rb2401");
    }
    
    auto end = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
    
    // HFT策略要求极低延迟，平均每个事件处理时间应小于10微秒
    double avgTimePerEvent = static_cast<double>(duration.count()) / EVENT_COUNT;
    EXPECT_LT(avgTimePerEvent, 10.0) << "HFT event processing too slow: " << avgTimePerEvent << " μs per event";
    
    std::cout << "HFT event processing performance: " << avgTimePerEvent << " μs per event" << std::endl;
}

// ============================================================================
// SelStrategyMgr测试套件
// ============================================================================

class SelStrategyMgrTest : public ::testing::Test
{
protected:
    void SetUp() override {
        WTSLogger::init("test_logs/", true);
        
        selMgr = std::make_unique<SelStrategyMgr>();
        mockStrategy = std::make_unique<NiceMock<MockSelStrategy>>();
        
        ON_CALL(*mockStrategy, getName())
            .WillByDefault(Return("TestSelStrategy"));
        ON_CALL(*mockStrategy, getFactName())
            .WillByDefault(Return("TestSelFactory"));
        ON_CALL(*mockStrategy, init(_))
            .WillByDefault(Return(true));
    }
    
    void TearDown() override {
        WTSLogger::stop();
    }

protected:
    std::unique_ptr<SelStrategyMgr> selMgr;
    std::unique_ptr<MockSelStrategy> mockStrategy;
};

/*!
 * \brief 测试SEL策略管理器基本功能
 */
TEST_F(SelStrategyMgrTest, TestBasicFunctionality)
{
    EXPECT_NE(selMgr.get(), nullptr);
    
    // 测试策略数量
    EXPECT_EQ(selMgr->count(), 0);
}

/*!
 * \brief 测试SEL策略选股功能
 */
TEST_F(SelStrategyMgrTest, TestStockSelection)
{
    // 测试选股相关事件
    EXPECT_CALL(*mockStrategy, on_calculate(_))
        .Times(1);
    EXPECT_CALL(*mockStrategy, on_calculate_done(_))
        .Times(1);
    
    // 模拟选股计算
    mockStrategy->on_calculate(nullptr);
    mockStrategy->on_calculate_done(nullptr);
}

/*!
 * \brief 测试SEL策略多股票处理
 */
TEST_F(SelStrategyMgrTest, TestMultiStockProcessing)
{
    std::vector<std::string> stocks = {
        "SSE.600000", "SSE.600036", "SSE.600519",
        "SZSE.000001", "SZSE.000002", "SZSE.300001"
    };
    
    // 测试多股票tick处理
    EXPECT_CALL(*mockStrategy, on_tick(_, _))
        .Times(stocks.size());
    
    for (const auto& stock : stocks) {
        mockStrategy->on_tick(nullptr, stock.c_str());
    }
}

// ============================================================================
// 策略管理器集成测试
// ============================================================================

class StrategyManagerIntegrationTest : public ::testing::Test
{
protected:
    void SetUp() override {
        WTSLogger::init("test_logs/", true);
        
        ctaMgr = std::make_unique<CtaStrategyMgr>();
        hftMgr = std::make_unique<HftStrategyMgr>();
        selMgr = std::make_unique<SelStrategyMgr>();
    }
    
    void TearDown() override {
        WTSLogger::stop();
    }

protected:
    std::unique_ptr<CtaStrategyMgr> ctaMgr;
    std::unique_ptr<HftStrategyMgr> hftMgr;
    std::unique_ptr<SelStrategyMgr> selMgr;
};

/*!
 * \brief 测试多策略管理器协同工作
 */
TEST_F(StrategyManagerIntegrationTest, TestMultiManagerCooperation)
{
    // 验证所有管理器都能正常创建
    EXPECT_NE(ctaMgr.get(), nullptr);
    EXPECT_NE(hftMgr.get(), nullptr);
    EXPECT_NE(selMgr.get(), nullptr);
    
    // 验证初始状态
    EXPECT_EQ(ctaMgr->count(), 0);
    EXPECT_EQ(hftMgr->count(), 0);
    EXPECT_EQ(selMgr->count(), 0);
}

/*!
 * \brief 测试策略管理器资源管理
 */
TEST_F(StrategyManagerIntegrationTest, TestResourceManagement)
{
    // 测试管理器的资源清理
    // 这里主要测试析构函数不会崩溃
    EXPECT_NO_THROW({
        auto tempCtaMgr = std::make_unique<CtaStrategyMgr>();
        auto tempHftMgr = std::make_unique<HftStrategyMgr>();
        auto tempSelMgr = std::make_unique<SelStrategyMgr>();
        
        // 让智能指针自动析构
    });
}

// ============================================================================
// 策略配置测试
// ============================================================================

class StrategyConfigurationTest : public ::testing::Test
{
protected:
    void SetUp() override {
        WTSLogger::init("test_logs/", true);
    }
    
    void TearDown() override {
        WTSLogger::stop();
    }
};

/*!
 * \brief 测试策略配置解析
 */
TEST_F(StrategyConfigurationTest, TestConfigurationParsing)
{
    // 创建复杂的策略配置
    WTSVariant* config = WTSVariant::createObject();
    
    // 基本配置
    config->append("name", "TestStrategy", false);
    config->append("id", "test_001", false);
    config->append("factory", "TestFactory", false);
    
    // 参数配置
    WTSVariant* params = WTSVariant::createObject();
    params->append("period", 5, false);
    params->append("threshold", 0.02, false);
    params->append("enabled", true, false);
    config->append("params", params, true);
    
    // 验证配置结构
    EXPECT_STREQ(config->getCString("name"), "TestStrategy");
    EXPECT_STREQ(config->getCString("id"), "test_001");
    EXPECT_STREQ(config->getCString("factory"), "TestFactory");
    
    WTSVariant* retrievedParams = config->get("params");
    EXPECT_NE(retrievedParams, nullptr);
    EXPECT_EQ(retrievedParams->getInt32("period"), 5);
    EXPECT_DOUBLE_EQ(retrievedParams->getDouble("threshold"), 0.02);
    EXPECT_TRUE(retrievedParams->getBoolean("enabled"));
    
    config->release();
}

/*!
 * \brief 测试策略配置验证
 */
TEST_F(StrategyConfigurationTest, TestConfigurationValidation)
{
    // 测试无效配置
    WTSVariant* invalidConfig = WTSVariant::createObject();
    // 缺少必要字段
    
    // 这里应该有配置验证逻辑，但由于没有直接的验证接口，
    // 我们测试配置的完整性
    EXPECT_EQ(invalidConfig->getCString("name"), nullptr);
    EXPECT_EQ(invalidConfig->getCString("id"), nullptr);
    
    invalidConfig->release();
    
    // 测试有效配置
    WTSVariant* validConfig = WTSVariant::createObject();
    validConfig->append("name", "ValidStrategy", false);
    validConfig->append("id", "valid_001", false);
    validConfig->append("factory", "ValidFactory", false);
    
    EXPECT_NE(validConfig->getCString("name"), nullptr);
    EXPECT_NE(validConfig->getCString("id"), nullptr);
    EXPECT_NE(validConfig->getCString("factory"), nullptr);
    
    validConfig->release();
}

// ============================================================================
// 策略性能监控测试
// ============================================================================

class StrategyPerformanceTest : public ::testing::Test
{
protected:
    void SetUp() override {
        WTSLogger::init("test_logs/", true);
        
        mockCtaStrategy = std::make_unique<NiceMock<MockCtaStrategy>>();
        mockHftStrategy = std::make_unique<NiceMock<MockHftStrategy>>();
        mockSelStrategy = std::make_unique<NiceMock<MockSelStrategy>>();
    }
    
    void TearDown() override {
        WTSLogger::stop();
    }

protected:
    std::unique_ptr<MockCtaStrategy> mockCtaStrategy;
    std::unique_ptr<MockHftStrategy> mockHftStrategy;
    std::unique_ptr<MockSelStrategy> mockSelStrategy;
};

/*!
 * \brief 测试CTA策略性能
 */
TEST_F(StrategyPerformanceTest, TestCtaStrategyPerformance)
{
    const int TICK_COUNT = 1000;
    
    auto start = std::chrono::high_resolution_clock::now();
    
    for (int i = 0; i < TICK_COUNT; ++i) {
        mockCtaStrategy->on_tick(nullptr, "SHFE.rb2401");
    }
    
    auto end = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
    
    double avgTimePerTick = static_cast<double>(duration.count()) / TICK_COUNT;
    EXPECT_LT(avgTimePerTick, 1000.0) << "CTA strategy tick processing too slow: " << avgTimePerTick << " μs per tick";
    
    std::cout << "CTA strategy performance: " << avgTimePerTick << " μs per tick" << std::endl;
}

/*!
 * \brief 测试HFT策略性能
 */
TEST_F(StrategyPerformanceTest, TestHftStrategyPerformance)
{
    const int EVENT_COUNT = 10000;
    
    auto start = std::chrono::high_resolution_clock::now();
    
    for (int i = 0; i < EVENT_COUNT; ++i) {
        mockHftStrategy->on_tick(nullptr, "SHFE.rb2401");
    }
    
    auto end = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
    
    double avgTimePerEvent = static_cast<double>(duration.count()) / EVENT_COUNT;
    EXPECT_LT(avgTimePerEvent, 10.0) << "HFT strategy event processing too slow: " << avgTimePerEvent << " μs per event";
    
    std::cout << "HFT strategy performance: " << avgTimePerEvent << " μs per event" << std::endl;
}

/*!
 * \brief 测试SEL策略性能
 */
TEST_F(StrategyPerformanceTest, TestSelStrategyPerformance)
{
    const int CALCULATION_COUNT = 100;
    
    auto start = std::chrono::high_resolution_clock::now();
    
    for (int i = 0; i < CALCULATION_COUNT; ++i) {
        mockSelStrategy->on_calculate(nullptr);
    }
    
    auto end = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
    
    double avgTimePerCalc = static_cast<double>(duration.count()) / CALCULATION_COUNT;
    EXPECT_LT(avgTimePerCalc, 10000.0) << "SEL strategy calculation too slow: " << avgTimePerCalc << " μs per calculation";
    
    std::cout << "SEL strategy performance: " << avgTimePerCalc << " μs per calculation" << std::endl;
}

// ============================================================================
// 策略错误处理测试
// ============================================================================

class StrategyErrorHandlingTest : public ::testing::Test
{
protected:
    void SetUp() override {
        WTSLogger::init("test_logs/", true);
        
        mockCtaStrategy = std::make_unique<NiceMock<MockCtaStrategy>>();
    }
    
    void TearDown() override {
        WTSLogger::stop();
    }

protected:
    std::unique_ptr<MockCtaStrategy> mockCtaStrategy;
};

/*!
 * \brief 测试策略异常处理
 */
TEST_F(StrategyErrorHandlingTest, TestExceptionHandling)
{
    // 测试空指针处理
    EXPECT_NO_THROW({
        mockCtaStrategy->on_tick(nullptr, nullptr);
        mockCtaStrategy->on_tick(nullptr, "");
    });
    
    // 测试无效数据处理
    EXPECT_NO_THROW({
        mockCtaStrategy->on_bar(nullptr, "INVALID.CODE", "m1", nullptr);
    });
}

/*!
 * \brief 测试策略初始化失败处理
 */
TEST_F(StrategyErrorHandlingTest, TestInitializationFailure)
{
    // 设置初始化失败
    EXPECT_CALL(*mockCtaStrategy, init(_))
        .WillOnce(Return(false));
    
    WTSVariant* config = WTSVariant::createObject();
    config->append("invalid_param", "invalid_value", false);
    
    bool result = mockCtaStrategy->init(config);
    EXPECT_FALSE(result);
    
    config->release();
}

// ============================================================================
// 主函数
// ============================================================================

int main(int argc, char** argv)
{
    ::testing::InitGoogleTest(&argc, argv);
    
    // 设置测试环境
    std::cout << "开始执行WonderTrader策略管理组件综合测试..." << std::endl;
    
    int result = RUN_ALL_TESTS();
    
    std::cout << "\n=== 策略管理测试总结 ===" << std::endl;
    std::cout << "✓ CtaStrategyMgr CTA策略管理器测试" << std::endl;
    std::cout << "✓ HftStrategyMgr HFT策略管理器测试" << std::endl;
    std::cout << "✓ SelStrategyMgr SEL策略管理器测试" << std::endl;
    std::cout << "✓ 策略管理器集成测试" << std::endl;
    std::cout << "✓ 策略配置管理测试" << std::endl;
    std::cout << "✓ 策略性能监控测试" << std::endl;
    std::cout << "✓ 策略错误处理测试" << std::endl;
    std::cout << "\n所有策略管理测试完成！" << std::endl;
    
    return result;
}